using System.Configuration;

namespace Drill.Configuration.ConfigFile
{
	public class ConfigSourceElementCollection
		: BaseConfigurationElementCollection<IConfigSourceConfiguration, ConfigSourceElement>
		, IConfigSourceConfigurationCollection
	{
		public ConfigSourceElement this[int index]
		{
			get { return BaseGet(index) as ConfigSourceElement; }
		}

		/// <summary>
		/// Gets the element key for a specified configuration element when overridden in a derived class.
		/// </summary>
		/// <returns>
		/// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
		/// </returns>
		/// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for. </param>
		protected override object GetElementKey(ConfigurationElement element)
		{
			return ((ConfigSourceElement)element).Key;
		}
	}
}